﻿/*
{
"状态":1,
"名称":"生成-BI日期数据",
"作者":"马学兵",
"创建时间":"2019-02-19",
"功能":"生成-BI日期数据",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

declare @year int ='{year}'

if exists(select 1 from EIDW.dbo.b_date where i_year=@year)
begin
	RAISERROR ('SQL:该年份数据已经产生,不允许重复生成', 16 ,1 ) ; 
	return 
end 

if not exists(select 1 from EIDW.dbo.b_date where i_year=@year-1)
begin
	RAISERROR ('SQL:前1年的数据还没生成,不允许跳跃', 16 ,1 ) ; 
	return 
end 

exec EIDW.dbo.usp_InsertDate @year=@year